Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Note linking #223

Merged
merged 1 commit into from
Sep 1, 2024
Merged

Note linking #223

merged 1 commit into from
Sep 1, 2024

Conversation

cloverich
Copy link
Owner

@cloverich cloverich commented Aug 25, 2024

Add linking from one note to another. Uses the @ symbol to trigger the dropdown menu, which provides note search functionality. On selecting a note, copy a reference to it, serialized as a link in the form of ../<journal_id>/<note_id>.md. The menu looks like:

Screenshot 2024-09-01 at 3 51 40 PM

When selecting an item, link will be embedded into the note; I ended up changing the color slightly to indicate its a note link. Did not put a ton of thought into the design here, want to use it in anger to organize my thoughts on it.

Screenshot 2024-09-01 at 3 52 21 PM

A couple of notes on some of the design choices:

  • Link format: Should be safe whether note is linked to same or different journal, and assumes a future export structure of <notesdir>/<journal_id>/<note_id>.
  • ariakit: Time was the most constrained yet the last month, so I grabbed examples that were closest to working and ran with it. Follow-up work is already planned to organize all comboboxes, so will naturally clean-up and make things consistent there
  • Inlined a few Plate components w/ some modifications: I find code diving esp. with changing versions very difficult to debug, and also found it easier to fully fork / customize. Longer term I think design will drift substantially, so probably better to start inlining. Did not put much work into organizing and will rely on future refactoring, esp. once I better understand Slate architecture, to clean it all up

Closes #124

Follow-up work:

@@ -364,14 +364,36 @@ function createBreak(node: mdast.Break) {

export type Link = ReturnType<typeof createLink>;

const noteLinkRegex = /^\.\/(?:(.+)\/)?([a-zA-Z0-9-]+)\.md$/;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Document implications of this. Should this live in the features/not-ref directory?

createNoteRefPlugin,
} from "./editor/features/note-ref/createNoteRefPlugin";

import { createNotRefElementPlugin } from "./editor/features/note-ref/createNoteRefElementPlugin";
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTERef; organize exports

@cloverich cloverich force-pushed the note_linking branch 3 times, most recently from a68fd69 to f1da4b6 Compare September 1, 2024 22:02
@cloverich cloverich changed the title wip: note linking Note linking Sep 1, 2024
- Adds the ability to link from one note to another, using the @ symbol.
- Pilots using a "feature" folder to colocate all feature code (plugin, element, mdast)
- Inlines several dependencies to support light customization or ease debugging
- ariakit combobox is intended to be temporary, refactored in or out in upcoming dropdown / tag input refactor
@cloverich cloverich merged commit 5e6ffc9 into master Sep 1, 2024
2 checks passed
@cloverich cloverich deleted the note_linking branch September 1, 2024 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal note linking
1 participant